package com.liz.tectSelect.vertxSpringbootRestfulApi;

import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

import javax.annotation.PostConstruct;

@SpringBootApplication
public class VertxSpringbootApp {

    @Autowired
    private VertxServer vertxServer;

    public static void main(String[] args) {

        try {
            // 不让springboot以web启动
            new SpringApplicationBuilder(VertxSpringbootApp.class).web(WebApplicationType.NONE).run(args);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @PostConstruct
    public void deployVerticle() {
        Vertx.vertx(new VertxOptions()).deployVerticle(vertxServer);
    }

}
